home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: Norman Bullen <nbullen@ix.netcom.com>
- Newsgroups: comp.lang.c
- Subject: Re: Standard question - pointer initialization
- Date: Wed, 06 Mar 1996 20:03:52 -0800
- Organization: Black Cat Associates
- Message-ID: <313E6028.1C19@ix.netcom.com>
- References: <4hk9un$906@hammer.msfc.nasa.gov> <4hl6rr$nde@news.xs4all.nl>
- NNTP-Posting-Host: ple-ca9-19.ix.netcom.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-NETCOM-Date: Wed Mar 06 10:01:08 PM CST 1996
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- Falstaff wrote:
- >
- > Brian.Day@msfc.nasa.gov (Brian Day) writes:
- >
- > >Hi all,
- >
- > >I don't have a copy of the ANSI standard handy, and was wondering
- > >if y'all could answer a question for me.
- >
- > >We were recently handed a coding standard which said:
- >
- > > "Always initialize pointers when they are declared"
- >
- > >Doesn't the standard say something about some pointers
- > >being automatically initialized to NULL, or something like that?
- >
- > No. Pointers like any other variables are not automagically initialized.
- >
- > >Is this coding standard wise?
- >
- > Even though using uninitialized pointers may lead to crashing your
- > system (especially non-memory-managed systems) faster than other
- > uninitialized variables, both omissions will lead to errors in the
- > program.
- > Compilers may help in detecting uninitialized variables, but otherwise
- > good programming practises should be followed to try to eliminate
- > these errors before they are programmed in.
- >
- > Frank
- > --
- > The famous GIICM now on line: http://www.xs4all.nl/~falstaff/GIICM.html
- > ------------------------------------------------------------------------> Frank A. Vorstenbosch +31-(70)-355 5241 falstaff@xs4all.nl
-
- And there is no point in initializing a pointer when its declared if you
- don't know at that point what an appropriate value might be. Use of a
- pointer that has been initialized with an inappropriate value can be just
- as bad for the program as using an uninitialize pointer.
-